function collect_same_elements(collection_a, collection_b) {
  //在这里写入代码
  function unique(arr){
    return Array.from(new Set(arr))
  }
  var a = unique(collection_a);
  var result = []
  for (let i = 0; i < a.length; i++) {
    for(let j = 0;j< collection_b.length;j++){
      if(a[i] == collection_b[i]){
        result.push(a[i]);
        break;
      }
    }
  }
  return result;
}

module.exports = collect_same_elements;
